package cn.yuanqiao.web.controller.archive.danganzhengli;

import cn.yuanqiao.archive.danganzhengli.domain.ImportArchiveLog;
import cn.yuanqiao.archive.danganzhengli.service.IImportArchiveLogService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.web.page.TableDataInfo;
import cn.yuanqiao.common.annotation.Log;
import cn.yuanqiao.common.enums.BusinessType;
import cn.yuanqiao.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/archive/importArchiveLog")
public class ImportArchiveLogController extends BaseController {
    @Autowired
    private IImportArchiveLogService importArchiveLogService;

    @Log(title = "查询导入记录", businessType = BusinessType.SELECT)
    @PostMapping("/getList")
    public TableDataInfo getOnlineReceptionList(ImportArchiveLog importArchiveLog){
        importArchiveLog.setTenantCode(SecurityUtils.getTenantCode());
        startPage();
        List<ImportArchiveLog> list = importArchiveLogService.getImportArchiveLogList(importArchiveLog);
        return getDataTable(list);
    }

    @Log(title = "根据ID查询导入记录", businessType = BusinessType.SELECT)
    @PostMapping("/getListById/{id}")
    public AjaxResult getOnlineReceptionList(@PathVariable("id") Long id){
        ImportArchiveLog importArchiveLogById = importArchiveLogService.getImportArchiveLogById(id);
        return AjaxResult.success(importArchiveLogById);
    }

}
